﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Erp.Migrations
{
    /// <inheritdoc />
    public partial class modify_table_OutboundDetl : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_OutboundDetl_MatlInfo_MatlInfoId",
                schema: "Erp",
                table: "OutboundDetl");

            migrationBuilder.DropColumn(
                name: "InboundPric",
                schema: "Erp",
                table: "OutboundDetl");

            migrationBuilder.DropColumn(
                name: "TrdnFlag",
                schema: "Erp",
                table: "OutboundDetl");

            migrationBuilder.RenameColumn(
                name: "MatlInfoId",
                schema: "Erp",
                table: "OutboundDetl",
                newName: "InboundDetlId");

            migrationBuilder.RenameIndex(
                name: "IX_OutboundDetl_MatlInfoId",
                schema: "Erp",
                table: "OutboundDetl",
                newName: "IX_OutboundDetl_InboundDetlId");

            migrationBuilder.AddForeignKey(
                name: "FK_OutboundDetl_InboundDetl_InboundDetlId",
                schema: "Erp",
                table: "OutboundDetl",
                column: "InboundDetlId",
                principalSchema: "Erp",
                principalTable: "InboundDetl",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_OutboundDetl_InboundDetl_InboundDetlId",
                schema: "Erp",
                table: "OutboundDetl");

            migrationBuilder.RenameColumn(
                name: "InboundDetlId",
                schema: "Erp",
                table: "OutboundDetl",
                newName: "MatlInfoId");

            migrationBuilder.RenameIndex(
                name: "IX_OutboundDetl_InboundDetlId",
                schema: "Erp",
                table: "OutboundDetl",
                newName: "IX_OutboundDetl_MatlInfoId");

            migrationBuilder.AddColumn<decimal>(
                name: "InboundPric",
                schema: "Erp",
                table: "OutboundDetl",
                type: "numeric(18,6)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<bool>(
                name: "TrdnFlag",
                schema: "Erp",
                table: "OutboundDetl",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddForeignKey(
                name: "FK_OutboundDetl_MatlInfo_MatlInfoId",
                schema: "Erp",
                table: "OutboundDetl",
                column: "MatlInfoId",
                principalSchema: "Erp",
                principalTable: "MatlInfo",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
